package com.mtsmda.oracleOfficialTutorialJAVA7.chapter1.nestedClasses;

public class AnonymousClassEx {
	
	interface HelloWord{
		public void print();
	}
	
	public void sayHelloOnOtherLanguages(){
		
		class EnglishGreeting implements HelloWord{
			
			private String name;
			
			public EnglishGreeting(String name) {
				this.name = name;
			}
			
			@Override
			public void print() {
				System.out.println("Hello world, " + name + "!");
			}
			
		}
		
		HelloWord helloWordEnglish = new EnglishGreeting("Dmitrii");
		helloWordEnglish.print();
		
		HelloWord helloWordRussian = new HelloWord() {
			@Override
			public void print() {
				System.out.println("Привет мир");
			}
		};
		
		helloWordRussian.print();
		
	}
	
	public static void main(String[] args) {
		new AnonymousClassEx().sayHelloOnOtherLanguages();
	}
	
}